﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:odc="clr-namespace:Odyssey.Controls" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Odyssey;Component/Themes/OutlookBar/ToggleButton.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type odc:OutlookSection}">
        <Setter Property="Background"
                Value="{DynamicResource {ComponentResourceKey odc:Skins, SectionButtonGradientBrush}}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey odc:Skins, ForegroundBrush}}" />
        <Setter Property="Height" Value="28" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type odc:OutlookSection}">
                    <ToggleButton Background="{TemplateBinding Background}" x:Name="button" TextBlock.FontWeight="Bold"
                            Focusable="True" Foreground="{TemplateBinding Foreground}"
                            IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsSelected}"
                            BorderThickness="0,1,0,0" Height="{TemplateBinding Height}" ClickMode="Press"
                            Style="{StaticResource buttonInSection}">
                        <ToggleButton.Content>
                            <DockPanel Focusable="False">
                                <Image RenderOptions.BitmapScalingMode="NearestNeighbor"
                                        RenderOptions.EdgeMode="Aliased" Source="{TemplateBinding Image}"
                                        Focusable="False" DockPanel.Dock="Left" Margin="4,0,4,0"
                                        SnapsToDevicePixels="False" ClipToBounds="True" VerticalAlignment="Center"
                                        Width="24" Height="24" />
                                <ContentPresenter x:Name="content" Focusable="False" Content="{TemplateBinding Header}"
                                        VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0" />
                            </DockPanel>
                        </ToggleButton.Content>
                    </ToggleButton>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMaximized" Value="False">
                            <Setter TargetName="content" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="button" Property="BorderThickness" Value="0" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>